﻿Public Class Consulta_Proveedor
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub BT_atras_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BT_atras.Click
        Response.Redirect("~/Consulta.aspx")
    End Sub

    Protected Sub BT_buscar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BT_buscar.Click
        panel_proveedor.Visible = True


        Dim nombre_proveedor As String
        Dim direc_proveedor As String
        Dim e_mail As String
        Dim contacto_proveedor As String
        Dim numero_telefono_prov As String

        Dim storexpress As New DCStorexpressDataContext
        Try
            Dim query = storexpress.p_buscar_proveedor(TB_nitp.Text)
            Dim registro = query.First

            nombre_proveedor = registro.NOMBRE_PROVEEDOR
            direc_proveedor = registro.DIREC_PROVEEDOR
            e_mail = registro.E_MAIL_PROVEEDOR
            contacto_proveedor = registro.CONTACTO_PROVEEDOR
            numero_telefono_prov = registro.NUMERO_TELEFONO_PROV


            TB_nombre.Text = nombre_proveedor
            TB_direccion.Text = direc_proveedor
            TB_correo.Text = e_mail
            TB_contacto.Text = contacto_proveedor
            TB_telefono.Text = numero_telefono_prov


        Catch ex As InvalidOperationException
            If MsgBox("no hay registros coincidentes") Then
                panel_proveedor.Visible = False
            End If

        End Try

    End Sub
End Class